<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Carrier extends Model
{
    use HasFactory;

    protected $fillable = [
        'name',
        'type'
    ];

    /**
     * 获取平台下的详细数据
     * @param int $_type 平台类型 1=公众号
     * @return \Illuminate\Database\Eloquent\Relations\HasOne
     */
    public function datum($_type = 1)
    {
        if($_type == 1) {
            return $this->hasOne(CarrierWechat::class);
        }
    }
}
